<?php
/**
 * Template Name: Front Page Template
 * Description: This is the very first home page
 *
 * @ Twyne
 */

get_header();?>

		<div id="primary">
			<div id="content" role="main">

				<header class="entry-header">
					<h1 class="entry-title">Welcome to Twyne!</h1>
				</header><!-- .entry-header -->
				
				<div id="front-page-description">
					<p>Twyne is a networking site that is aimed towards making your transistion easier upon moving to a new location.
					Twyne brings you closer to the people you may be in need of connecting with. You can join private Groups created by your organizations, or join public Groups chosen by city. Begin exploring by selecting an option below.</p>
				</div>
				<header id="front-page-exploring">
					<h3>Begin Exploring....</h3>
				</header>
					
				<div id="frontpage_option1">
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js "></script>
<script language="Javascript" src="<?php bloginfo('stylesheet_directory'); ?>/javascript/popup-dialog.js"></script>

					<h3 id="frontpage_option1">
						<a href="#" onclick="verify_group_code();">Connect Through an Organization</a>
					</h3>
					<p id="frontpage_option1">Organizations can make private Groups where only specified members are allowed to join.
					This creates a networking environment that is shared with only members that are part of an organization
					</p>
					<?php if ( ! is_user_logged_in() ) { //if user is not logged in ?>
						<a href="<?php bloginfo('url'); ?>/wp-login.php/">
							<img src="<?php bloginfo('stylesheet_directory'); ?>/graphics/Graphic2.png" alt="Connect by location" width="220" height="220" />
						</a>
					<?php	} else { ?>
							
							<a href="#">
								<img src="<?php bloginfo('stylesheet_directory'); ?>/graphics/Graphic2.png" alt="Connect by location" width="220" height="220"  onclick="verify_group_code();"/>
							</a>
							<script language="Javascript" src="<?php bloginfo('stylesheet_directory'); ?>/javascript/popup-dialog.js"></script>
					
					<?php	/* Create a Nonce for the previous Ajax request verify_group_code()
							*/
							
							wp_enqueue_script( 'my-ajax-request', get_stylesheet_directory_uri()."/javascript/popup-dialog.js", array( 'jquery' ) );
							wp_localize_script( 'my-ajax-request', 'MyAjax', array(
								// URL to wp-admin/admin-ajax.php to process the request
								'ajaxurl'          => admin_url( 'admin-ajax.php' ),
								
								// generate a nonce with a unique ID "myajax-post-comment-nonce"
								// so that you can check it later when an AJAX request is sent
								'postCommentNonce' => wp_create_nonce( 'myajax-post-comment-nonce' ),
								)
							);
							}  ?>
				</div><!--#frontpage_option1-->
				
				<div id="frontpage_option2">
					<h3 id="frontpage_option2">
						<a href="<?php bloginfo('url'); ?>/mygroups/">Connect Through a City</a>
					</h3>
					<p id="frontpage_option2">Publicly begin connecting with others through a particular city</p>
					<?php if ( ! is_user_logged_in() ) { //if user is not logged in ?>
						<a href="<?php bloginfo('url'); ?>/wp-login.php/">
							<img src="<?php bloginfo('stylesheet_directory'); ?>/graphics/city_graphic.jpg" alt="Connect by location" width="300" height="300" />
						</a>
					<?php	} else { ?>
						<a href="<?php bloginfo('url'); ?>/mygroups/">
							<img src="<?php bloginfo('stylesheet_directory'); ?>//graphics/city_graphic.jpg" alt="Connect by location" width="300" height="300"/>
						</a>	
					<?php	}  ?>
				</div><!--#frontpage_option2-->
				
			
				<div id="frontpage_option3">
					<?php if ( ! is_user_logged_in() ) { //if user is not logged in ?>
						<h3 id="frontpage_option3">
							<a href="<?php bloginfo('url'); ?>/register/">Create a User Account</a>
						</h3>
						<p id="frontpage_option3">Login with your existing username and password or create a new account by signing up!</p>
						<a href="<?php bloginfo('url'); ?>/register/">
							<img src="<?php bloginfo('stylesheet_directory'); ?>/graphics/Graphic1.png" alt="Connect by location" width="220" height="220" />
						</a>
					<?php } else { ?>
						<h3 id="frontpage_option3">
							<a href="<?php bloginfo('url'); ?>/home/">Create a User Account</a>
						</h3>
						<p id="frontpage_option3">Login with your existing username and password or create a new account by signing up!</p>
						<a href="<?php bloginfo('url'); ?>/home/">
							<img src="<?php bloginfo('stylesheet_directory'); ?>/graphics/Graphic1.png" alt="Connect by location" width="220" height="220" />
						</a>
					<?php } ?>
				</div><!--#frontpage_option3-->

				</article><!-- #post-<?php the_ID(); ?> -->
				
			</div><!-- #content -->
		</div><!-- #primary -->

<?php 
	get_sidebar('empty');
	get_footer(); ?>